package com.cal.utms.action.maintenance;



import com.cal.utms.dao.maintenance.CustomerDaoImpl;
import com.cal.utms.dto.maintenance.CustomerBankAccountDto;
import com.cal.utms.model.maintenance.CustomerModel;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class CustomerAccountAction extends ActionSupport implements ModelDriven<CustomerBankAccountDto> {

	private static final long serialVersionUID = 1L;

	CustomerDaoImpl accountDao = new CustomerDaoImpl();
	CustomerBankAccountDto accountBean = new CustomerBankAccountDto();
	private boolean success;
	private int customer_id;

	public String getAccountsByCustomerId() {
		success = true;
		accountBean.setBankAccounts(CustomerModel.createAccountBeans(accountDao.getBankAccountByCustomerId(customer_id)));
		return Action.SUCCESS;
	}

	@Override
	public CustomerBankAccountDto getModel() {
		return accountBean;
	}

	public CustomerBankAccountDto getAccountBean() {
		return accountBean;
	}

	public void setAccountBean(CustomerBankAccountDto accountBean) {
		this.accountBean = accountBean;
	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public int getCustomer_id() {
		return customer_id;
	}

	public void setCustomer_id(int customer_id) {
		this.customer_id = customer_id;
	}

}
